import { createModule } from '@/router/type'
import LayoutView from '@/layout/LayoutView.vue'
import { registerComponentName } from '@/utils'

export default createModule([
  {
    path: '/device',
    redirect: '/device/gateway-manage',
    component: LayoutView,
    meta: {
      icon: import('~icons/menu/device'),
      title: '设备'
    },
    children: [
      {
        path: 'gateway-manage',
        name: 'GatewayManage',
        meta: { title: '网关接入' },
        component: () => import('@views/gateway/gateway-manage.vue')
      },
      {
        path: 'variable-template',
        name: 'VariableTemplate',
        meta: { title: '变量模板' },
        component: () => import('@views/variable/variable-template.vue')
      },
      {
        path: 'add-variable-template',
        name: 'AddVariableTemplate',
        meta: { title: '添加变量模板', isMenu: false },
        component: registerComponentName('AddVariableTemplate', import('@views/variable/save-variable-template.vue'))
      },
      {
        path: 'check-variable-template',
        name: 'CheckVariableTemplate',
        meta: { title: '查看变量模板', isMenu: false },
        component: registerComponentName('CheckVariableTemplate', import('@views/variable/save-variable-template.vue'))
      },
      {
        path: 'edit-variable-template',
        name: 'EditVariableTemplate',
        meta: { title: '配置变量模板', isMenu: false },
        component: registerComponentName('EditVariableTemplate', import('@views/variable/save-variable-template.vue'))
      },
      {
        path: 'device-manage',
        name: 'DeviceManage',
        meta: { title: '设备管理' },
        component: () => import('@views/device/device-manage.vue')
      },
      {
        path: 'add-device',
        name: 'AddDevice',
        meta: { title: '添加设备', isMenu: false },
        component: registerComponentName('AddDevice', import('@views/device/save-device.vue'))
      },
      {
        path: 'check-device',
        name: 'CheckDevice',
        meta: { title: '查看设备', isMenu: false },
        component: registerComponentName('CheckDevice', import('@views/device/save-device.vue'))
      },
      {
        path: 'edit-device',
        name: 'EditDevice',
        meta: { title: '编辑设备', isMenu: false },
        component: registerComponentName('EditDevice', import('@views/device/save-device.vue'))
      },
      {
        path: 'scene-manage',
        name: 'SceneManage',
        meta: { title: '场景管理' },
        component: () => import('@views/scene/scene-manage.vue')
      }
    ]
  }
], true)
